﻿using ControlHelper.Tools;
using Creator.Core.Base;
using Creator.Core.DataBind;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Creator.Core
{ 
    public static  class SystemData
    {

        private static string path = Directory.GetCurrentDirectory() + @"\BaseConfig.json";
        private static List<ProcessObject> processObjects = new List<ProcessObject>();

        /// <summary>
        /// 过程对象合集
        /// 每个过程都可以添加相对应的组件
        /// 每个组件都有自己的处理逻辑
        /// </summary>
        public static List<ProcessObject> ProcessObjects
        {
            get
            {
                //processObjects = JsonHelper.ReadJson<List<ProcessObject>>(Directory.GetCurrentDirectory() + @"\BaseConfig.json");

                //if (processObjects == null)
                //{
                //    processObjects = new List<ProcessObject>();
                //}
                ////重新定向引用关系
                //foreach (var baseObject in processObjects)
                //{
                //    foreach (var behaviour in baseObject.Behaviours)
                //    {
                //        if (behaviour == null) continue;
                //        behaviour.BaseObject = processObjects.Find(obj => obj.Id == behaviour.BaseObjectId);
                //    }
                //}
                return processObjects; 
            }
            set
            {

                processObjects = value;
            } 
        }

        /// <summary>
        /// 储存需要显示的类型所应该显示绑定类型
        /// </summary>
        public static List<BindConfig> BindConfigs { get; set; } = new List<BindConfig>();
 
    }
}
